class Solution:
    def subsetXORSum(self, nums):
        total = 0
        n = len(nums)
        # 枚举所有可能的子集
        for mask in range(1 << n):
            xor_sum = 0
            # 检查每个元素是否在当前子集中
            for i in range(n):
                if mask & (1 << i):
                    xor_sum ^= nums[i]
            total += xor_sum
        return total    